package alogrithm;

/**
 * @author lbw
 * @version 1.0
 * @date 2021/10/19 11:30
 */
public class ReOrderArray {
    public int[] reOrderArray(int[] array) {
        // write code here
        int n = array.length;
        int[] res = new int[n];
        int j = 0;
        for (int i = 0; i < n; ++i) {
            if ((array[i] & 1) == 1) {
                res[j++] = array[i];
            }
        }
        for (int i = 0; i < n; ++i) {
            if ((array[i] & 1) == 0) {
                res[j++] = array[i];
            }
        }
        return res;
    }
}
